package com.grf.function.controller;

import com.grf.function.function.CustomizeConsumer;
import com.grf.function.function.CustomizePredicate;
import com.grf.function.function.CustomizeSupplier;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 特殊函数bean注入
 * @author: grf
 * @date: 2024/9/1
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/special/bean")
public class SpecialBeanController {
    public final CustomizeSupplier customizeSupplier;

    public final CustomizeConsumer customizeConsumer;

    public final CustomizePredicate customizePredicate;

    /**
     * @description: 供给型函数
     * @author: grf
     * @date: 2024/9/1
     */
    @GetMapping("/supplier")
    public void getSupplier(){
        var ll = customizeSupplier.get();
        log.info("supplier bean controller : {}", ll);
    }
    /**
     * @description: 消费性
     * @author: grf
     * @date: 2024/9/1
     */
    @GetMapping("/consumer")
    public void getConsumer(){
        customizeConsumer.consumer("consumer bean controller;");
    }
    /**
     * @description: 断言型
     * @author: grf
     * @date: 2024/9/1
     */
    @GetMapping("/predicate")
    public void getPredicate(@RequestParam String param){
        var ll = customizePredicate.test(param);
        log.info("predicate bean controller: {}", ll);
    }
}
